Copyright>        OpenRadioss
Copyright>        Copyright (C) 1986-2024 Altair Engineering Inc.
Copyright>
Copyright>        This program is free software: you can redistribute it and/or modify
Copyright>        it under the terms of the GNU Affero General Public License as published by
Copyright>        the Free Software Foundation, either version 3 of the License, or
Copyright>        (at your option) any later version.
Copyright>
Copyright>        This program is distributed in the hope that it will be useful,
Copyright>        but WITHOUT ANY WARRANTY; without even the implied warranty of
Copyright>        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Copyright>        GNU Affero General Public License for more details.
Copyright>
Copyright>        You should have received a copy of the GNU Affero General Public License
Copyright>        along with this program.  If not, see <https://www.gnu.org/licenses/>.
Copyright>
Copyright>
Copyright>        Commercial Alternative: Altair Radioss Software
Copyright>
Copyright>        As an alternative to this open-source version, Altair also offers Altair Radioss
Copyright>        software under a commercial license.  Contact Altair to discuss further if the
Copyright>        commercial version may interest you: https://www.altair.com/radioss/.
Chd|====================================================================
Chd|  SREPLOC3                      source/elements/solid/solide/sreploc3.F
Chd|-- called by -----------
Chd|        S10INIT3                      source/elements/solid/solide10/s10init3.F
Chd|        S4INIT3                       source/elements/solid/solide4/s4init3.F
Chd|-- calls ---------------
Chd|====================================================================
      SUBROUTINE SREPLOC3(
     .   RX   ,RY   ,RZ   ,SX   ,SY   ,SZ   ,TX   ,TY   ,TZ   ,
     .   E1X  ,E2X  ,E3X  ,E1Y  ,E2Y  ,E3Y  ,E1Z  ,E2Z  ,E3Z  )
C-----------------------------------------------
C   I m p l i c i t   T y p e s
C-----------------------------------------------
#include      "implicit_f.inc"
C-----------------------------------------------
C   G l o b a l   P a r a m e t e r s
C-----------------------------------------------
C   D u m m y   A r g u m e n t s
C-----------------------------------------------
C     REAL
      my_real
     .   RX(*) ,RY(*) ,RZ(*) ,SX(*) ,SY(*) ,SZ(*) ,TX(*) ,TY(*) ,TZ(*),
     .   E1X(*),E1Y(*),E1Z(*),E2X(*),E2Y(*),E2Z(*),E3X(*),E3Y(*),E3Z(*)
C-----------------------------------------------
C   C o m m o n   B l o c k s
C-----------------------------------------------
#include      "vect01_c.inc"
C-----------------------------------------------
C   L o c a l   V a r i a b l e s
C-----------------------------------------------
      INTEGER I
C     REAL
      my_real
     .   SUM
C=======================================================================
C     Orthogonalisation du repere
C       E1=R, E3=R^S, E2=E3^E1                            
C
      DO I=LFT,LLT                                      
        SUM = SQRT(RX(I)**2+RY(I)**2+RZ(I)**2)          
        IF (SUM > ZERO) SUM=ONE/SUM                      
        E1X(I) = RX(I)*SUM                              
        E1Y(I) = RY(I)*SUM                              
        E1Z(I) = RZ(I)*SUM                              
        E3X(I) = E1Y(I)*SZ(I) - E1Z(I)*SY(I)              
        E3Y(I) = E1Z(I)*SX(I) - E1X(I)*SZ(I)              
        E3Z(I) = E1X(I)*SY(I) - E1Y(I)*SX(I)              
        SUM = SQRT(E3X(I)**2+E3Y(I)**2+E3Z(I)**2)       
        IF (SUM > ZERO) SUM=ONE/SUM                      
        E3X(I) = E3X(I)*SUM                             
        E3Y(I) = E3Y(I)*SUM                             
        E3Z(I) = E3Z(I)*SUM                             
        E2X(I) = E3Y(I)*E1Z(I) - E3Z(I)*E1Y(I)                 
        E2Y(I) = E3Z(I)*E1X(I) - E3X(I)*E1Z(I)                 
        E2Z(I) = E3X(I)*E1Y(I) - E3Y(I)*E1X(I)                 
        SUM = SQRT(E2X(I)**2+E2Y(I)**2+E2Z(I)**2)         
        IF (SUM > ZERO) SUM=ONE/SUM                      
        E2X(I) = E2X(I)*SUM                             
        E2Y(I) = E2Y(I)*SUM                             
        E2Z(I) = E2Z(I)*SUM                             
      ENDDO                                             
C-------------
      RETURN
      END SUBROUTINE SREPLOC3
